<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>合同下载->预览</title>
    <link href="css/style.css" rel="stylesheet">
    <style>
        .icon {
            min-height: 200px;
            border: solid 1px rgb(219, 219, 219);
            padding: 10px;
            position: relative;
        }
    </style>

    <script type="text/javascript" src="/js/jquery.min.js"></script>
    <script type="text/javascript" >
        $(function () {
            init();

            $("#download").on("click", function () {
                $("#contract").attr("action","/contract/customServiceDownload");
                $("#contract").submit();
            });
        });

        function init() {
            var text = $("#prevBlock").text(); //先取出未转换格式前端数据
            var des = text.replace(/\r\n/g, '<br/>').replace(/\n/g, '<br/>').replace(/\s/g, ' ');  //转换格式
            $("#prevBlock").empty();
            $("#prevBlock").append(des);
        }
    </script>

</head>

<body>
<div style="height: 80px;position: relative;">
    <div style="text-align: center;position: absolute;left: 40%;">
        <h2 th:text="${name}+'-合同模板预览'">保密协议-合同模板预览</h2>
    </div>
    <div style="height:80px; position: absolute;right: 0;">
        <form th:action="@{~/contract/download(id=${id})}" method="POST">
            <input type="submit" value="下载" class="btn ant-btn ant-btn-red" />
        </form>
    </div>

</div>
<div>
    <div contenteditable="true" class="icon" style="margin-bottom: 10px;height: 100%;">
        <p id="prevBlock" th:text="${text}">合同内容</p>
    </div>
</div>
</body>

</html>